package com.suneast.suneaststore.modules.shopcart.adapter;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suneast.suneaststore.R;
import com.suneast.suneaststore.bean.shopcart.ShopGoodsListBean;
import com.suneast.suneaststore.ui.recycler.decoration.SpaceItemDecoration;

public class BillAdapter extends BaseQuickAdapter<ShopGoodsListBean, BaseViewHolder> {

    public BillAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, ShopGoodsListBean item) {

        helper.setText(R.id.shop_name_tv, item.getMerchname());

        RecyclerView goodsRV = helper.getView(R.id.rv_goods);
        ItemBillAdapter adapter =
                new ItemBillAdapter(R.layout.item_goods_bill_item, item.getGoods());
        goodsRV.setLayoutManager(new LinearLayoutManager(helper.itemView.getContext()));
        goodsRV.addItemDecoration(
                new SpaceItemDecoration(0, 0, 0, 5));
        goodsRV.setAdapter(adapter);
    }
}
